// components/musiclist/musiclist.js
const app = getApp()
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    musicList:{
      type:Array
    }
  },
  pageLifetimes:{
    show(){
      this.setData({
        playingId:parseInt(app.getPlayMusicId())
      })
    }
  },
  /**
   * 组件的初始数据
   */
  data: {
    playingId:-1
  },

  /**
   * 组件的方法列表
   */
  methods: {
    // 被选中的歌曲事件
    onSelect(event){
      const ecd = event.currentTarget.dataset
      const musicid = ecd.musicid
      const musicIndex = ecd.index
      this.setData({
        playingId:musicid
      })
      wx.navigateTo({
        url: `../../pages/player/player?musicId=${musicid}&index=${musicIndex}`,
      })
    }
  }
})
